﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MaxLeaf.Platform.DataContract;
using CommonsLib.DB;
using MaxLeaf.Platform.DALImplementation;
using MaxLeaf.Platform.Functions;
using CommonsLib.Utility;
using MaxLeaf.Platform.Commons;
using MaxLeaf.Platform.Contract;
using System.Transactions;

namespace MaxLeaf.Platform.BLLImplementation
{
    public class OutputProcessor : IOutputProcess
    {

        private bool Auto_Appro(imOthersOutputHdrDataModel modelOthersOutputHdr)
        {
            CategroyApproDataModel model = new CategroyApproDataModel
            {
                BillFinterID = CvtFunc.ToString(modelOthersOutputHdr.Key)
                ,
                CompanyID = CvtFunc.ToString(modelOthersOutputHdr.CompanyID)
                ,
                DepartAppro = true
                ,
                FinterIDType = (int)FinterIDType.OthersOutput
                ,
                UserID = CvtFunc.ToString(modelOthersOutputHdr.EnterUserID)
            };

            CategroyApproBLL bllAppro = new CategroyApproBLL();
            model = bllAppro.NeedInvLocApproval(model);
            if (!model.Success)
            {
                bllAppro.DepartApproval(model);

                return model.Success;
            }

            return false;
        }

  
        
 

        public bool AutoLocAppro(imOthersOutputHdrDataModel modelHdr)
        {
            return Auto_Appro(modelHdr);
        }
    }
}
